function getToken() {
    token = window.localStorage.getItem('current_user');
    if(!token){
        window.location.href = '/admin/login';
        return false;
    }
    return token;
}

/*获取几天前时间日期*/
function getValidDate(dayCount = 1) {
    curDate = new Date();
    preDate = new Date(curDate.getTime() - dayCount * 24 * 60 * 60 * 1000);

    year = preDate.getFullYear();
    month = preDate.getMonth() + 1;
    if (month < 10) {
        month = '0' + month;
    }
    day = preDate.getDate();
    if (day < 10) {
        day = '0' + day;
    }
    result = year + '-' + month + '-' + day;
    return result;
}